package com.ruoyi.system.utils;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.RequiredArgsConstructor;

import java.io.Serializable;

@Data
@NoArgsConstructor
@RequiredArgsConstructor
public class ResultModel<T> implements Serializable {
    //返回结果状态码
    private Integer state=StateCode.OK;
    //返回结果消息
    private String messages="successful";
    //返回数据
    @NonNull
    private T data;
    //有参构造
    public ResultModel(Integer state){
        this.state=state;
    }
    public ResultModel(Integer state, T data){
        this.state=state;
        this.data=data;
    }
    public ResultModel(Integer state, String messages, T data){
        this.state=state;
        this.data=data;
        this.messages=messages;
    }

}

class StateCode {
    //数据
    public static final Integer OK =2000;
    //数据异常码
    public static final Integer RESULT_DATA_EXCEPTION =4001;
    //参数异常码
    public static final Integer PARAM_EXCEPTION =4002;
    //运行异常码
    public static final Integer RUNTIME_EXCEPTION =4003;
    //乘客信息异常码
    public static final Integer PASSENGERINFO_EXCEPTION =4004;
    //回调信息异常码
    public static final Integer NOTIFY_EXCEPTION =4005;
    //短信通知异常码
    public static final Integer SMSMESSAGE_EXCEPTION =4006;
    //未知异常码
    public static final Integer EXCEPTION =5000;

}
